import tkinter

root=tkinter.Tk()    #创建一个实例对象
root.title("某坑教育机构一对一工资计算器")   #标题
root.minsize(400,480)   #窗口大小（宽×高）

#设置可自由输入文本框
entry1=tkinter.Entry(root)
entry1.place(x=100,y=10,width=40,height=30)

entry2=tkinter.Entry(root)
entry2.place(x=100,y=50,width=40,height=30)

entry3=tkinter.Entry(root)
entry3.place(x=100,y=90,width=40,height=30)

entry4=tkinter.Entry(root)
entry4.place(x=100,y=130,width=40,height=30)

entry5=tkinter.Entry(root)
entry5.place(x=100,y=170,width=40,height=30)

entry6=tkinter.Entry(root)
entry6.place(x=100,y=210,width=40,height=30)

entry7=tkinter.Entry(root)
entry7.place(x=100,y=290,width=40,height=30)

entry8=tkinter.Entry(root)
entry8.place(x=310,y=10,width=50,height=30)

entry9=tkinter.Entry(root)
entry9.place(x=310,y=50,width=50,height=30)

entry10=tkinter.Entry(root)
entry10.place(x=310,y=130,width=50,height=30)

#设置不可改文本框（列1）
label1=tkinter.Label(root,text='初一课时=',bg='yellow')
label1.place(x=20,y=10,width=70,height=30)

label2=tkinter.Label(root,text='初二课时=',bg='yellow')
label2.place(x=20,y=50,width=70,height=30)

label3=tkinter.Label(root,text='初三课时=',bg='yellow')
label3.place(x=20,y=90,width=70,height=30)

label4=tkinter.Label(root,text='高一课时=',bg='yellow')
label4.place(x=20,y=130,width=70,height=30)

label5=tkinter.Label(root,text='高二课时=',bg='yellow')
label5.place(x=20,y=170,width=70,height=30)

label6=tkinter.Label(root,text='高三课时=',bg='yellow')
label6.place(x=20,y=210,width=70,height=30)

label7=tkinter.Label(root,text='总课时数=',bg='yellow')
label7.place(x=20,y=250,width=70,height=30)

label8=tkinter.Label(root,text='星级=',bg='yellow')
label8.place(x=20,y=290,width=70,height=30)

label9=tkinter.Label(root,text='一对一课时费=',bg='yellow')
label9.place(x=10,y=330,width=80,height=30)


label10=tkinter.Label(root,text='工资总计=',bg='yellow')
label10.place(x=190,y=380,width=70,height=30)

#设置不可改文本框（列2）
label11=tkinter.Label(root,text='0.85',bg='green')
label11.place(x=150,y=10,width=40,height=30)

label12=tkinter.Label(root,text='0.85',bg='green')
label12.place(x=150,y=50,width=40,height=30)

label13=tkinter.Label(root,text='1',bg='green')
label13.place(x=150,y=90,width=40,height=30)

label14=tkinter.Label(root,text='1.1',bg='green')
label14.place(x=150,y=130,width=40,height=30)

label15=tkinter.Label(root,text='1.1',bg='green')
label15.place(x=150,y=170,width=40,height=30)

label16=tkinter.Label(root,text='1.3',bg='green')
label16.place(x=150,y=210,width=40,height=30)

label17=tkinter.Label(root,text='←平均倍率',bg='pink')
label17.place(x=210,y=250,width=70,height=30)

label18=tkinter.Label(root,text='该计算器未计入非课时奖及其他扣费',bg='pink')
label18.place(x=90,y=430,width=220,height=30)

#设置不可改文本框（列3）
label19=tkinter.Label(root,text='实际出勤天数=',bg='yellow')
label19.place(x=210,y=10,width=90,height=30)

label20=tkinter.Label(root,text='本月应出勤天数=',bg='yellow')
label20.place(x=210,y=50,width=90,height=30)

label21=tkinter.Label(root,text='基础工资=',bg='yellow')
label21.place(x=210,y=90,width=70,height=30)

label22=tkinter.Label(root,text='社保=',bg='yellow')
label22.place(x=210,y=130,width=70,height=30)


def start():

    class_hour7=entry1.get()
    class_hour8=entry2.get()
    class_hour9=entry3.get()
    class_hour10=entry4.get()
    class_hour11=entry5.get()
    class_hour12=entry6.get()
    j=entry7.get()
    fee=3*(int(j)-3)    #星级间差额
    
#总小时数↓
    whole_class_hour=float(0)   #总课时数
    for i in range(7,13):
        x=eval('class_hour'+str(i))
        if type(x) == float:
            whole_class_hour+=x
        else:
            x=float(x)
            whole_class_hour+=x
    whole_hour=round(whole_class_hour*2/3,2)
#    print('总小时数=',whole_hour)
    
#年级倍率↓
    percentage7=0.85
    percentage8=0.85
    percentage9=1.0
    percentage10=1.1
    percentage11=1.1
    percentage12=1.3

#加权平均倍率↓
    average_percentage=0   #平均倍率
    for i in range(7,13):
        y=float(eval('class_hour'+str(i)))*float(eval('percentage'+str(i)))
        average_percentage+=y
    average_percentage=average_percentage/whole_class_hour
#    print('平均倍率',average_percentage)

#计算课时费
        
    class_fees=0   #课时费
    if whole_hour<=35:
        class_fees=0
    elif whole_hour>35 and whole_hour<=60:
        class_fees=(34+fee)*(whole_hour-35)*average_percentage
    elif whole_hour>60 and whole_hour<=90:
        class_fees=((34+fee)*(60-35)+(50+fee)*(whole_hour-60))*average_percentage
    elif whole_hour>90 and whole_hour<=120:
        class_fees=((34+fee)*(60-35)+(50+fee)*(90-60)+(55+fee)*(whole_hour-90))*average_percentage
    elif whole_hour>120 and whole_hour<=150:
        class_fees=((34+fee)*(60-35)+(50+fee)*(90-60)+(55+fee)*(120-90)+(60+fee)*(whole_hour-120))*average_percentage
    else:
        class_fees=((34+fee)*(60-35)+(50+fee)*(90-60)+(55+fee)*(120-90)+(60+fee)*(150-120)+(65+fee)*(whole_hour-150))*average_percentage
#    print('一对一课时费=',class_fees)


    basic_wage=2300+200*(int(j)-3)  #基础工资
    koufei=entry10.get()   #社保 
    day=entry8.get()
    all_day=entry9.get()
    basic_gongzi=basic_wage*eval(day)/eval(all_day)-eval(koufei)
    gongzi=basic_gongzi+class_fees
#   print('不计入非课时奖及其他扣费的总工资=',gongzi)

    label23=tkinter.Label(root,text=eval('whole_class_hour'),bg='pink')
    label23.place(x=100,y=250,width=40,height=30)

    label24=tkinter.Label(root,text='%.2f' %(eval('class_fees')),bg='pink')
    label24.place(x=100,y=330,width=60,height=30)

    label25=tkinter.Label(root,text=eval('basic_wage'),bg='pink')
    label25.place(x=310,y=90,width=40,height=30)

    label26=tkinter.Label(root,text='%.2f' %(eval('gongzi')),bg='pink')
    label26.place(x=270,y=380,width=70,height=30)

    label27=tkinter.Label(root,text='%.2f' %(eval('average_percentage')),bg='pink')
    label27.place(x=150,y=250,width=40,height=30)

btn=tkinter.Button(root,text='开始计算',bg='orange',command=start)
btn.place(x=190,y=310,width=70,height=40)

root.mainloop()





